import { GET, POST } from '@/service';

/**
 * 上传成功后的回调（小程序）
 * @param params
 */
export const uploadCallback = (params) => {
	const url = '/api/huaweiVod/uploadCallback';

	return POST(url, params);
};

/**
 * 查询素材圈规则
 * @param {*} params
 * @returns Promise
 */
export const getResourceRule = (params) => {
	const url = '/api/dict/getResourceRule';

	return GET(url, params);
};

/**
 * 素材圈首页-素材情况统计
 * @param {*} params
 * @returns
 */
export const getResourceCount = (params) => {
	const url = '/api/tdProduct/resourceCount';

	return GET(url, params);
};

/**
 * 素材资源查询服务（分页）
 * @param {*} params
 * @returns
 */
export const getQueryDetail = (params) => {
	const url = '/api/material/queryDetail';

	return POST(url, params, {
		header: {
			'Content-type': 'application/x-www-form-urlencoded'
		}
	});
};

/**
 * 素材资源查询服务（不分页）
 * @param {*} params
 * @returns
 */
export const getQueryAllDetail = (params) => {
	const url = '/api/material/queryDetailNoPage';

	return POST(url, params, {
		header: {
			'Content-type': 'application/x-www-form-urlencoded'
		}
	});
};

/**
 * 获取临时上传凭证 (华为)
 * @param {*} params
 * @returns
 */
export const getHWUploadToken = (params) => {
	const url = '/api/huaweiVod/getToken';

	return POST(url, params);
};

/**
 * 获取文件上传签名链接 （阿里云）
 * @param {*} params
 * @returns
 */
export const getALYUploadToken = (params) => {
	const url = '/api/oss/getSign';

	return POST(url, params);
};

/**
 * 素材订单详情: 素材上传-订单详情(审核中-审核完成)-展开订单详情-上面的产品信息
 * @param {*} params
 * @returns
 */
export const getMaterailDetail = (params) => {
	const url = '/api/tdOrder/resource/openDetail';

	return POST(url, params);
};

/**
 * 审核中-资源获取（分类不分页）
 * @param {*} params
 * @returns
 */
export const getMaterailStatusList = (params) => {
	const url = '/api/tdOrder/resource/detail/ing';

	return POST(url, params);
};

/**
 * 已通过审核-资源获取（分页不分类）
 * @param {*} params
 * @returns
 */
export const getMaterailDoneList = (params) => {
	const url = '/api/tdOrder/resource/detail/done';

	return POST(url, params);
};

/**
 * 素材订单上架-下架
 * @param {*} params
 * @returns
 */
export const changeOnOffShelf = (params) => {
	const url = '/api/tdOrder/onOffShelf';

	return GET(url, params);
};

/**
 * 增加素材资源预览记录接口
 * @param {*} params
 * @returns
 */
export const addMaterialPreview = (params) => {
	const url = '/api/material/preview';

	return GET(url, params);
};

/**
 * 视频播放、下载链接（防盗链B）
 * @param {*} params
 * @returns
 */
export const getVideoPreviewUrl = (params) => {
	const url = '/api/huaweiVod/createPlayUrlByAlgorithmA';

	return GET(url, params);
};

/**
 * 获取用户的免费下载次数及余额
 * @param {*} params
 * @returns
 */
export const getFreeDownloadAndBalance = (params) => {
	const url = '/api/userInfo/getFreeDownloadAndBalance';

	return GET(url, params);
};

/**
 * 统一下单-支付
 * @param {*} params
 * @returns
 */
export const buyMaterial = (params) => {
	const url = '/api/tdAccount/order';

	return POST(url, params);
};

/**
 * 购买素材-资源获取（分页分类）
 * @param {*} params
 * @returns
 */
export const getBuyMaterialList = (params) => {
	const url = '/api/tdOrder/resource/detail/pay';

	return POST(url, params);
};

/**
 * 产品基础详情
 * @param {*} params
 * @returns
 */
export const getSingleProductDetail = (params) => {
	const url = '/api/material/productDetail';

	return GET(url, params);
};
